package com.cskaoyan.mall.product.controller;


import com.cskaoyan.mall.common.result.Result;
import com.cskaoyan.mall.product.dto.TestDTO;
import com.cskaoyan.mall.product.service.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TestController {

    @Autowired
    TestService testService;

    @GetMapping("/test/product")
    public Result getProduct(Long productId) {

        TestDTO productById
                = testService.getProductById(productId);

        return Result.ok(productById);
    }

    @GetMapping("admin/product/lock")
    public Result testLock() {
        testService.incrWithLock();
        return Result.ok();
    }


}
